import request from '@/utils/request'

// 获取方案分类树
export function getSolutionCategoryTree() {
  return request({
    url: '/dispatch/dispatch/dispatchSolution/category',
    method: 'get'
  })
}

// 新增方案分类
export function addSolutionCategory(data) {
  return request({
    url: '/dispatch/dispatch/dispatchSolution/category',
    method: 'post',
    data
  })
}

// 修改方案分类
export function updateSolutionCategory(data) {
  return request({
    url: '/dispatch/dispatch/dispatchSolution/category',
    method: 'put',
    data
  })
}

// 删除方案分类
export function deleteSolutionCategory(categoryId) {
  return request({
    url: `/dispatch/dispatch/dispatchSolution/category/${categoryId}`,
    method: 'delete'
  })
}

// 查询方案列表
export function getSolutionList(params) {
  return request({
    url: '/dispatch/dispatch/dispatchSolution/list',
    method: 'get',
    params
  })
}

// 获取方案详情
export function getSolutionDetail(solutionId) {
  return request({
    url: `/dispatch/dispatch/dispatchSolution/${solutionId}`,
    method: 'get'
  })
}

// 新增方案
export function addSolution(data) {
  return request({
    url: '/dispatch/dispatch/dispatchSolution',
    method: 'post',
    data
  })
}

// 修改方案
export function updateSolution(data) {
  return request({
    url: '/dispatch/dispatch/dispatchSolution',
    method: 'put',
    data
  })
}

// 删除方案
export function deleteSolution(solutionIds) {
  return request({
    url: `/dispatch/dispatch/dispatchSolution/${solutionIds}`,
    method: 'delete'
  })
}

// 查询调度日志列表
export function getDispatchLogList(params) {
  return request({
    url: '/dispatch/dispatch/dispatchSolution/log/list',
    method: 'get',
    params
  })
}

// 从调度日志添加方案
export function addSolutionFromLog(params) {
  return request({
    url: '/dispatch/dispatch/dispatchSolution/log/add',
    method: 'get',
    params
  })
}